<script setup lang="ts">
import { onMounted, computed } from 'vue'
import { useAuthStore } from '@/stores/auth'
import { useRoute } from 'vue-router'
import AIFloatingButton from '@/components/AIFloatingButton.vue'

const authStore = useAuthStore()
const route = useRoute()

// 只在登录后的页面显示AI助手
const showAIAssistant = computed(() => {
  return authStore.isLoggedIn() && 
         !['Login', 'Register'].includes(route.name as string)
})

onMounted(() => {
  authStore.initAuth()
})
</script>

<template>
  <div id="app">
    <router-view />
    <AIFloatingButton v-if="showAIAssistant" />
  </div>
</template>

<style>
#app {
  font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100vh;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: #f5f5f5;
}
</style>
